Configuration cDscClientAddPsModuleFolder
{
    param(
	[Parameter(Mandatory)]
	[ValidateNotNullOrEmpty()]
	[String]$ServerName,

	[Parameter(Mandatory)]
	[ValidateNotNullOrEmpty()]
	[PSObject]$ToolFolder,

	[Parameter(Mandatory)]
	[ValidateNotNullOrEmpty()]
	[PSObject]$PowershellFolder
    )

    #Log Message
    Log StartConfiguration
    {
        Message = "Start Configuration for $ServerName"
    } 

    #Ensure Tools folder is present on the managed server
    File "RootFolder_$($ToolFolder.uniqueKey)" {
        Ensure="Present"
        Type="Directory"
        DestinationPath = $ToolFolder.Path
    }

    #Download the Archive zip file
    File "DownloadArchive_$($PowershellFolder.uniqueKey)" {
        Ensure="Present"
        Type="File"
        DestinationPath = [System.IO.Path]::Combine($($ToolFolder.Path), ([System.IO.Path]::GetFileName($PowershellFolder.ArchiveSourcePath)))
        SourcePath = $PowershellFolder.ArchiveSourcePath
        DependsOn = "[File]RootFolder_$($ToolFolder.uniqueKey)"
    }

    #Uncompress the Archive in the targeted Folder (TODO : How manage clean folder before)
    Archive "UncompressArchive_$($PowershellFolder.uniqueKey)" {
        DependsOn = "[File]DownloadArchive_$($PowershellFolder.uniqueKey)"
        Ensure = 'Present'
        Path = [System.IO.Path]::Combine($($ToolFolder.Path), ([System.IO.Path]::GetFileName($PowershellFolder.ArchiveSourcePath)))
        Destination = $PowershellFolder.Path
    }

    #Create the psModulePath : environment Name must be unique across a server configuration
    <#
    Environment "PSModulePath_$($PowershellFolder.uniqueKey)" {
            Name = "PSModulePath"
            Ensure = "Present"
            Path = $true
            Value = $PowershellFolder.Path
            DependsOn = "[Archive]UncompressArchive_$($PowershellFolder.uniqueKey)"
        }
    #>
}


<#
$toolFolder = New-Object PSObject -Property @{
                                         UniqueKey="ToolsFolder"
                                         Path="D:\Devel\DebugDsc\ToolsFolder"
                                        }


$powershellFolder = New-Object PSObject -Property @{
                                          UniqueKey="DscResourcesFolder"
                                          Path="D:\Devel\DebugDsc\DscResourcesFolder"
                                          ArchiveSourcePath="\\SANS-VGA\BinariesRepository\nssm-2.23.zip"
                                        }

$Server = New-Object psobject -Property @{
                                        Name="sans-vga"
                                        RootFolders= @{}
                                        PowershellFolders = @()
                                        }

$Server.RootFolders.Add($toolFolder.UniqueKey, $toolFolder)

cDscClientAddPsModuleFolder -ToolFolder $toolFolder -PowershellFolder $powershellFolder -OutputPath D:\devel\dscoutput\cDscClientAddPsModuleFolder

#>
